INCLUDE_DIRECTORIES(include)

LIST(APPEND MODULE_SRC src/Timepix3Event2StdEventConverter.cc)
MESSAGE(STATUS "Timepix3 StandardEvent converter will be built")

IF(SPIDR_FOUND)
  LIST(APPEND MODULE_SRC src/Timepix3Config.cxx src/Timepix3Producer.cxx)
  MESSAGE(STATUS "Building Timepix3 Producer")

  FIND_PACKAGE(ROOT REQUIRED)
  FIND_PACKAGE(XercesC REQUIRED)

  INCLUDE_DIRECTORIES(${SPIDR_INCLUDE_DIR} ${ROOT_INCLUDE_DIRS} ${XercesC_INCLUDE_DIRS})
  SET(EXT_LIBRARIES ${SPIDR_LIB} ${XercesC_LIBRARIES} ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES})
ELSE()
  MESSAGE(WARNING "Timepix3 Producer NOT built: SPIDR, ROOT and/or Xerces-C are missing")
ENDIF()

ADD_LIBRARY(${EUDAQ_MODULE} SHARED ${MODULE_SRC})
TARGET_LINK_LIBRARIES(${EUDAQ_MODULE} ${EUDAQ_CORE_LIBRARY} ${EUDAQ_LCIO_LIBRARY} ${EXT_LIBRARIES})


INSTALL(TARGETS
  ${EUDAQ_MODULE}
  RUNTIME DESTINATION bin
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib)
